home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / Kool / Kool.jar / kool / Player.class (.txt) < prev    next >
Encoding:
Java Class File  |  2001-12-24  |  1.0 KB  |  33 lines

  1. package kool;
  2.  
  3. import com.siemens.mp.game.Sprite;
  4.  
  5. public class Player extends Sprite {
  6.    public static final int LEFT = 0;
  7.    public static final int RIGHT = 5;
  8.    public int speed = 4;
  9.    public int score = 0;
  10.    public int lives = 3;
  11.    public int animCount = 0;
  12.    public int orientation;
  13.  
  14.    public Player(byte[] img, byte[] mask, int w, int h, int fr) {
  15.       super(img, 0, w, h, mask, 0, fr);
  16.       ((Sprite)this).setCollisionRectangle(2, 3, w - 4, h - 3);
  17.    }
  18.  
  19.    public void setOrientation(int o) {
  20.       this.orientation = o;
  21.       this.animCount = 0;
  22.    }
  23.  
  24.    public void animate() {
  25.       ++this.animCount;
  26.       if (this.animCount >= 5) {
  27.          this.animCount = 0;
  28.       }
  29.  
  30.       ((Sprite)this).setFrame(this.animCount + this.orientation);
  31.    }
  32. }
  33.